﻿using System;
using System.Configuration;
using System.IO;
using System.Xml.Serialization;
using System.Xml;

namespace Catalyst.Configuration
{
	public static class ConfigurationManager
	{
		public static DatabaseElementCollection Databases
		{
			get
			{
				//CatalystSection section = (CatalystSection)ConfigurationSettings.GetConfig("catalyst"); 


				//ConfigurationElement

				//string result = "";
				//ExeConfigurationFileMap configFile = new ExeConfigurationFileMap();
				//configFile.ExeConfigFilename = "App.config";
				
				//if (string.IsNullOrEmpty(configFile.ExeConfigFilename))
				//    throw new ArgumentNullException("The project does not contain App.config or Web.config file.");

				var config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);// (Environment.CurrentDirectory + "\\Testing.exe");

				//Catalyst.Configuration.CatalystSection section = (Catalyst.Configuration.CatalystSection)config.GetSection("catalyst");


				CatalystSection section = (CatalystSection)System.Configuration.ConfigurationManager.GetSection("catalyst");

				return section.Databases;
			}
		}
	}
}
